package hy.controller;


import hy.entity.Dept;
import hy.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class ProviderCtrl {
    int num;
    @Autowired
    DeptService service;

    @GetMapping("/dept/get/{id}")
    public Dept get(@PathVariable Integer id){
        System.out.println("provider01--num:=====***"+num++);
        return service.get(id);
    }

    @GetMapping("/dept/list")
    public List<Dept> getAll(){
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {}
        System.out.println("provider01--num:"+num++);
        return service.list();
    }
}
